from django.db import models

from clazz.models import Clazz
from course.models import Course


# Create your models here.
class Student(models.Model):
    student_name = models.CharField(max_length=50, verbose_name='名字')
    student_no = models.CharField(max_length=50, unique=True, verbose_name='学号')
    student_age = models.IntegerField(verbose_name='年龄')
    student_sex = models.SmallIntegerField(default=1, verbose_name='性别 1男 2女')
    student_tel = models.CharField(max_length=20, unique=True, verbose_name='联系方式')
    student_state = models.SmallIntegerField(default=1, verbose_name='学生状态 1在学 2休学')
    school_time = models.DateField(verbose_name='入学时间')
    clazz = models.ForeignKey(Clazz, on_delete=models.PROTECT, verbose_name='班级')
    course = models.ForeignKey(Course, on_delete=models.PROTECT, verbose_name='课程')
    create_time = models.DateField(auto_now_add=True)

    class Meta:
        db_table = 'student'
